package d5_printstream;

import java.io.FileNotFoundException;
import java.io.PrintStream;

/**
 * 2024/6/20 掌握打印流：PrintStream/PrintWriter的用法
 */
public class PrintTest2 {
    public static void main(String[] args) {
        System.out.println("老骥伏枥");
        System.out.println("志在千里");

        try (PrintStream ps= new PrintStream("file-io2\\src\\test\\PrintStream1");){
            //把系统默认的打印流对象改成自己设置的打印流
            System.setOut(ps);
            System.out.println("烈士暮年");
            System.out.println("壮心不已");


        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
